<?php
/**
 * @var \yii\web\View $this
 */
$log_path = \common\models\credit_app\Member::getLogPath();
if (is_dir($log_path)){
    $log_files = scandir($log_path);
    foreach ($log_files as $k => $v){
        if ($v=='.')unset($log_files[$k]);
        if ($v=='..')unset($log_files[$k]);
    }
}
$this->title = '导入member日志';
$data = file_get_contents(\common\models\credit_app\Member::getLogPath().DIRECTORY_SEPARATOR.$file);
eval("\$data = ".$data.'; ');
if (is_array($data)){
    $keys = array_keys($data[0]);
//    foreach ($data as $k => $v){
//        $keys = array_keys($v);
//        break;
//    }
}
?>

<div class="others-default-check-member-import-log">
    <div class="row">
        <div class="col-lg-12">
            <h4>详细</h4>
            <div class="table-responsive">
                <table class="table table-border table-responsive table-hover table-member-import-log" style="overflow:scroll;width: 100%">
                    <?php if (isset($keys)): ?>
                        <thead>
                        <tr>
                            <?php foreach ($keys as $k1 => $v1): ?>
                                <th><?=$v1 ?></th>
                            <?php endforeach; ?>
                        </tr>
                        </thead>
                    <?php endif; ?>
                    <tbody>
                    <?php foreach ($data as $k => $v): ?>
                        <tr>
                            <?php foreach ($v as $k1 => $v1): ?>
                                <td><?=$v1 ?></td>
                            <?php endforeach; ?>
                        </tr>
                    <?php endforeach; ?>
                    </tbody>
                </table>
            </div>
        </div>
        <?php if (isset($log_files)): ?>
            <div class="col-lg-12">
                <h4>日志</h4>
                <?php foreach($log_files as $k => $v): ?>
                    <?=\yii\helpers\Html::a($v, ['check-member-import-log', 'file'=>$v], ['class'=>'btn btn-info', 'disabled'=>$v==$file?true:false]) ?>
                <?php endforeach; ?>
            </div>
        <?php endif; ?>
    </div>
</div>